Applies a function to a single part. When the part is stored as a
model_spec, fn can change it with the term helpers.
Examples
m <- model_spec(x1) |> set_parts(model_spec(firm))
modify_part(m, 1, \(p) add_terms(p, year))
#> model_spec: ~ x1 | firm + year